<!DOCTYPE html>
<html lang="es">
<head>
	<meta charset="utf-8">
	<title><?php echo $seo['titulo'];?></title>
	
<?php
	if(isset($this->carabiner)){
		$this->carabiner->display('css');
		$this->carabiner->display('js');
	}
?>
<script type="text/javascript" charset="UTF-8">
	var base_url = "<?php echo base_url();?>",
	opcmenu_active = '<?php echo isset($opcmenu_active)? $opcmenu_active: 0;?>';
</script>
</head>
<body>
<div>
	<div class="titulo ajus w100 am-c"><?php echo $seo['titulo']; ?></div>
	<form action="<?php echo base_url('panel/facturacion/get_ordenest'); ?>" method="get" id="frmFiltrosCotiza" class="frmfiltros corner-all8 btn-gray">
		<label for="ffcliente">Cliente:</label> 
		<input type="text" name="ffcliente" id="ffcliente" value="<?php echo $this->input->get('ffcliente'); ?>" size="13"> | 

		<label for="ffecha1">Fecha del:</label> 
		<input type="text" name="ffecha1" id="ffecha1" value="<?php echo $this->input->get('ffecha1'); ?>" size="8">
		
		<label for="ffecha2">Al:</label> 
		<input type="text" name="ffecha2" id="ffecha2" value="<?php echo $this->input->get('ffecha2'); ?>" size="8"> | 
		
		<label for="ffolio">Folio:</label>
		<input type="text" name="ffolio" id="ffolio" value="<?php echo $this->input->get('ffolio'); ?>" size="8"> |
		<input type="hidden" name="id_cliente" value="<?php echo $this->input->get('id_cliente'); ?>">
				
		<input type="submit" name="enviar" value="Enviar" class="btn-blue corner-all">
	</form>
	
	<table class="tblListados corner-all8">
		<tr class="header btn-gray">
			<td>Fecha</td>
			<td>Folio</td>
			<td>Cliente</td>
			<td>Total</td>
			<td>Status</td>
			<td class="a-c">Opc</td>
		</tr>
<?php foreach($orden['orden'] as $factu){
		$status = 'Pendiente';
		if($factu->status == 'pa')
			$status = 'Pagada';
		elseif($factu->status == 'ca')
			$status = 'Cancelada';
?>
		<tr>
			<td><?php echo $factu->fecha; ?></td>
			<td><?php echo ($factu->serie!=''? $factu->serie.'-': '').$factu->folio; ?></td>
			<td><?php echo $factu->nombre_fiscal; ?></td>
			<td><?php echo String::formatoNumero($factu->total); ?></td>
			<td><?php echo $status; ?></td>
			<td class="tdsmenu a-c" style="width: 90px;">
				<input type="checkbox" class="ordents" value="<?php echo $factu->id_ordent; ?>">
			</td>
		</tr>
<?php }?>
	</table>
	
	<input type="button" name="agregar" value="Agregar" id="btnAgregarOrdens" class="btn-blue corner-all f-r">
	<div class="clear"></div>
	
<?php
//Paginacion
$this->pagination->initialize(array(
		'base_url' 			=> base_url($this->uri->uri_string()).'?'.String::getVarsLink(array('pag')).'&',
		'total_rows'		=> $orden['total_rows'],
		'per_page'			=> $orden['items_per_page'],
		'cur_page'			=> $orden['result_page']*$orden['items_per_page'],
		'page_query_string'	=> TRUE,
		'num_links'			=> 1,
		'anchor_class'		=> 'pags corner-all'
));
$pagination = $this->pagination->create_links();
echo '<div class="pagination w100">'.$pagination.'</div>'; 
?>
</div>

<!-- Bloque de alertas -->
<?php if(isset($frm_errors)){
	if($frm_errors['msg'] != ''){ 
?>
<div id="container" style="display:none">
	<div id="withIcon">
		<a class="ui-notify-close ui-notify-cross" href="#">x</a>
		<div style="float:left;margin:0 10px 0 0"><img src="#{icon}" alt="warning" width="64" height="64"></div>
		<h1>#{title}</h1>
		<p>#{text}</p>
		<div class="clear"></div>
	</div>
</div>
<script type="text/javascript" charset="UTF-8">
$(function(){
	create("withIcon", {
		title: '<?php echo $frm_errors['title']; ?>', 
		text: '<?php echo $frm_errors['msg']; ?>', 
		icon: '<?php echo base_url('application/images/alertas/'.$frm_errors['ico'].'.png'); ?>' });
});
</script>
<?php }
}?>
<!-- Bloque de alertas -->

</body>
</html>